<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=US-ASCII">
<title>Class template aligned_allocator_adaptor</title>
<link rel="stylesheet" href="../../../../doc/src/boostbook.css" type="text/css">
<meta name="generator" content="DocBook XSL Stylesheets V1.78.1">
<link rel="home" href="../../index.html" title="The Boost C++ Libraries BoostBook Documentation Subset">
<link rel="up" href="../../align/reference.html#header.boost.align.aligned_allocator_adaptor_hpp" title="Header &lt;boost/align/aligned_allocator_adaptor.hpp&gt;">
<link rel="prev" href="operator___idp38164192.html" title="Function template operator!=">
<link rel="next" href="aligned_allocator_adaptor/rebind.html" title="Struct template rebind">
</head>
<body bgcolor="white" text="black" link="#0000FF" vlink="#840084" alink="#0000FF">
<table cellpadding="2" width="100%"><tr>
<td valign="top"><img alt="Boost C++ Libraries" width="277" height="86" src="../../../../boost.png"></td>
<td align="center"><a href="../../../../index.html">Home</a></td>
<td align="center"><a href="../../../../libs/libraries.htm">Libraries</a></td>
<td align="center"><a href="http://www.boost.org/users/people.html">People</a></td>
<td align="center"><a href="http://www.boost.org/users/faq.html">FAQ</a></td>
<td align="center"><a href="../../../../more/index.htm">More</a></td>
</tr></table>
<hr>
<div class="spirit-nav">
<a accesskey="p" href="operator___idp38164192.html"><img src="../../../../doc/src/images/prev.png" alt="Prev"></a><a accesskey="u" href="../../align/reference.html#header.boost.align.aligned_allocator_adaptor_hpp"><img src="../../../../doc/src/images/up.png" alt="Up"></a><a accesskey="h" href="../../index.html"><img src="../../../../doc/src/images/home.png" alt="Home"></a><a accesskey="n" href="aligned_allocator_adaptor/rebind.html"><img src="../../../../doc/src/images/next.png" alt="Next"></a>
</div>
<div class="refentry">
<a name="boost.alignment.aligned_allocator_adaptor"></a><div class="titlepage"></div>
<div class="refnamediv">
<h2><span class="refentrytitle">Class template aligned_allocator_adaptor</span></h2>
<p>boost::alignment::aligned_allocator_adaptor</p>
</div>
<h2 xmlns:rev="http://www.cs.rpi.edu/~gregod/boost/tools/doc/revision" class="refsynopsisdiv-title">Synopsis</h2>
<div xmlns:rev="http://www.cs.rpi.edu/~gregod/boost/tools/doc/revision" class="refsynopsisdiv"><pre class="synopsis"><span class="comment">// In header: &lt;<a class="link" href="../../align/reference.html#header.boost.align.aligned_allocator_adaptor_hpp" title="Header &lt;boost/align/aligned_allocator_adaptor.hpp&gt;">boost/align/aligned_allocator_adaptor.hpp</a>&gt;

</span><span class="keyword">template</span><span class="special">&lt;</span><span class="keyword">typename</span> Allocator<span class="special">,</span> <span class="identifier">std</span><span class="special">::</span><span class="identifier">size_t</span> Alignment<span class="special">&gt;</span> 
<span class="keyword">class</span> <a class="link" href="aligned_allocator_adaptor.html" title="Class template aligned_allocator_adaptor">aligned_allocator_adaptor</a> <span class="special">:</span> <span class="keyword">public</span> <span class="identifier">Allocator</span> <span class="special">{</span>
<span class="keyword">public</span><span class="special">:</span>
  <span class="comment">// types</span>
  <span class="keyword">typedef</span> <span class="identifier">Traits</span><span class="special">::</span><span class="identifier">value_type</span> <a name="boost.alignment.aligned_allocator_adaptor.value_type"></a><span class="identifier">value_type</span><span class="special">;</span>        
  <span class="keyword">typedef</span> <span class="identifier">Traits</span><span class="special">::</span><span class="identifier">size_type</span>  <a name="boost.alignment.aligned_allocator_adaptor.size_type"></a><span class="identifier">size_type</span><span class="special">;</span>         
  <span class="keyword">typedef</span> <span class="identifier">value_type</span> <span class="special">*</span>       <a name="boost.alignment.aligned_allocator_adaptor.pointer"></a><span class="identifier">pointer</span><span class="special">;</span>           
  <span class="keyword">typedef</span> <span class="keyword">const</span> <span class="identifier">value_type</span> <span class="special">*</span> <a name="boost.alignment.aligned_allocator_adaptor.const_pointer"></a><span class="identifier">const_pointer</span><span class="special">;</span>     
  <span class="keyword">typedef</span> <span class="keyword">void</span> <span class="special">*</span>             <a name="boost.alignment.aligned_allocator_adaptor.void_pointer"></a><span class="identifier">void_pointer</span><span class="special">;</span>      
  <span class="keyword">typedef</span> <span class="keyword">const</span> <span class="keyword">void</span> <span class="special">*</span>       <a name="boost.alignment.aligned_allocator_adaptor.const_void_pointer"></a><span class="identifier">const_void_pointer</span><span class="special">;</span>
  <span class="keyword">typedef</span> <span class="identifier">std</span><span class="special">::</span><span class="identifier">ptrdiff_t</span>     <a name="boost.alignment.aligned_allocator_adaptor.difference_type"></a><span class="identifier">difference_type</span><span class="special">;</span>   

  <span class="comment">// member classes/structs/unions</span>
  <span class="keyword">template</span><span class="special">&lt;</span><span class="keyword">typename</span> U<span class="special">&gt;</span> 
  <span class="keyword">struct</span> <a class="link" href="aligned_allocator_adaptor/rebind.html" title="Struct template rebind">rebind</a> <span class="special">{</span>
    <span class="comment">// types</span>
    <span class="keyword">typedef</span> <a class="link" href="aligned_allocator_adaptor.html" title="Class template aligned_allocator_adaptor">aligned_allocator_adaptor</a><span class="special">&lt;</span> <span class="keyword">typename</span> <span class="identifier">Traits</span><span class="special">::</span><span class="keyword">template</span> <span class="identifier">rebind_alloc</span><span class="special">&lt;</span> <span class="identifier">U</span> <span class="special">&gt;</span><span class="special">,</span> <span class="identifier">Alignment</span> <span class="special">&gt;</span> <a class="link" href="aligned_allocator_adaptor/rebind.html#boost.alignment.aligned_allocator_adaptor.rebind.other"><span class="identifier">other</span></a><span class="special">;</span>
  <span class="special">}</span><span class="special">;</span>

  <span class="comment">// <a class="link" href="aligned_allocator_adaptor.html#boost.alignment.aligned_allocator_adaptorconstruct-copy-destruct">construct/copy/destruct</a></span>
  <a class="link" href="aligned_allocator_adaptor.html#idp49513360-bb"><span class="identifier">aligned_allocator_adaptor</span></a><span class="special">(</span><span class="special">)</span> <span class="special">=</span> <span class="keyword">default</span><span class="special">;</span>
  <span class="keyword">template</span><span class="special">&lt;</span><span class="keyword">typename</span> A<span class="special">&gt;</span> <span class="keyword">explicit</span> <a class="link" href="aligned_allocator_adaptor.html#idp49514784-bb"><span class="identifier">aligned_allocator_adaptor</span></a><span class="special">(</span><span class="identifier">A</span> <span class="special">&amp;&amp;</span><span class="special">)</span> <span class="keyword">noexcept</span><span class="special">;</span>
  <span class="keyword">template</span><span class="special">&lt;</span><span class="keyword">typename</span> U<span class="special">&gt;</span> 
    <a class="link" href="aligned_allocator_adaptor.html#idp49520512-bb"><span class="identifier">aligned_allocator_adaptor</span></a><span class="special">(</span><span class="keyword">const</span> <a class="link" href="aligned_allocator_adaptor.html" title="Class template aligned_allocator_adaptor">aligned_allocator_adaptor</a><span class="special">&lt;</span> <span class="identifier">U</span><span class="special">,</span> <span class="identifier">Alignment</span> <span class="special">&gt;</span> <span class="special">&amp;</span><span class="special">)</span> <span class="keyword">noexcept</span><span class="special">;</span>

  <span class="comment">// <a class="link" href="aligned_allocator_adaptor.html#idp38188272-bb">public member functions</a></span>
  <span class="identifier">Allocator</span> <span class="special">&amp;</span> <a class="link" href="aligned_allocator_adaptor.html#idp38188832-bb"><span class="identifier">base</span></a><span class="special">(</span><span class="special">)</span> <span class="keyword">noexcept</span><span class="special">;</span>
  <span class="keyword">const</span> <span class="identifier">Allocator</span> <span class="special">&amp;</span> <a class="link" href="aligned_allocator_adaptor.html#idp38191088-bb"><span class="identifier">base</span></a><span class="special">(</span><span class="special">)</span> <span class="keyword">const</span> <span class="keyword">noexcept</span><span class="special">;</span>
  <span class="identifier">pointer</span> <a class="link" href="aligned_allocator_adaptor.html#idp38193344-bb"><span class="identifier">allocate</span></a><span class="special">(</span><span class="identifier">size_type</span><span class="special">)</span><span class="special">;</span>
  <span class="identifier">pointer</span> <a class="link" href="aligned_allocator_adaptor.html#idp38202160-bb"><span class="identifier">allocate</span></a><span class="special">(</span><span class="identifier">size_type</span><span class="special">,</span> <span class="identifier">const_void_pointer</span><span class="special">)</span><span class="special">;</span>
  <span class="keyword">void</span> <a class="link" href="aligned_allocator_adaptor.html#idp49504000-bb"><span class="identifier">deallocate</span></a><span class="special">(</span><span class="identifier">pointer</span><span class="special">,</span> <span class="identifier">size_type</span><span class="special">)</span><span class="special">;</span>
<span class="special">}</span><span class="special">;</span></pre></div>
<div class="refsect1">
<a name="idp125928416"></a><h2>Description</h2>
<p>Class template <a class="link" href="aligned_allocator_adaptor.html" title="Class template aligned_allocator_adaptor">aligned_allocator_adaptor</a>.</p>
<p>
</p>
<div class="note"><table border="0" summary="Note">
<tr>
<td rowspan="2" align="center" valign="top" width="25"><img alt="[Note]" src="../../../../doc/src/images/note.png"></td>
<th align="left">Note</th>
</tr>
<tr><td align="left" valign="top"><p>This adaptor can be used with a C++11 allocator whose pointer type is a smart pointer but the adaptor will expose only raw pointers. </p></td></tr>
</table></div>
<p>
</p>
<div class="refsect2">
<a name="idp125930976"></a><h3>Template Parameters</h3>
<div class="orderedlist"><ol class="orderedlist" type="1">
<li class="listitem"><pre class="literallayout"><span class="keyword">typename</span> Allocator</pre></li>
<li class="listitem">
<pre class="literallayout"><span class="identifier">std</span><span class="special">::</span><span class="identifier">size_t</span> Alignment</pre>
<p>Is the minimum alignment to specify for allocations, if it is larger than the alignment of the value type. The value of <code class="computeroutput">Alignment</code> shall be a fundamental alignment value or an extended alignment value, and shall be a power of two.</p>
</li>
</ol></div>
</div>
<div class="refsect2">
<a name="idp125937744"></a><h3>
<a name="boost.alignment.aligned_allocator_adaptorconstruct-copy-destruct"></a><code class="computeroutput">aligned_allocator_adaptor</code> 
        public
       construct/copy/destruct</h3>
<div class="orderedlist"><ol class="orderedlist" type="1">
<li class="listitem">
<pre class="literallayout"><a name="idp49513360-bb"></a><span class="identifier">aligned_allocator_adaptor</span><span class="special">(</span><span class="special">)</span> <span class="special">=</span> <span class="keyword">default</span><span class="special">;</span></pre>
<p>Value-initializes the <code class="computeroutput">Allocator</code> base class. </p>
</li>
<li class="listitem">
<pre class="literallayout"><span class="keyword">template</span><span class="special">&lt;</span><span class="keyword">typename</span> A<span class="special">&gt;</span> <span class="keyword">explicit</span> <a name="idp49514784-bb"></a><span class="identifier">aligned_allocator_adaptor</span><span class="special">(</span><span class="identifier">A</span> <span class="special">&amp;&amp;</span> alloc<span class="special">)</span> <span class="keyword">noexcept</span><span class="special">;</span></pre>
<p>Initializes the <code class="computeroutput">Allocator</code> base class with <code class="computeroutput">std::forward&lt;A&gt;(alloc)</code>.</p>
<p><span class="bold"><strong>Require:</strong></span> <code class="computeroutput">Allocator</code> shall be constructible from <code class="computeroutput">A</code>. </p>
<p>
</p>
</li>
<li class="listitem">
<pre class="literallayout"><span class="keyword">template</span><span class="special">&lt;</span><span class="keyword">typename</span> U<span class="special">&gt;</span> 
  <a name="idp49520512-bb"></a><span class="identifier">aligned_allocator_adaptor</span><span class="special">(</span><span class="keyword">const</span> <a class="link" href="aligned_allocator_adaptor.html" title="Class template aligned_allocator_adaptor">aligned_allocator_adaptor</a><span class="special">&lt;</span> <span class="identifier">U</span><span class="special">,</span> <span class="identifier">Alignment</span> <span class="special">&gt;</span> <span class="special">&amp;</span> other<span class="special">)</span> <span class="keyword">noexcept</span><span class="special">;</span></pre>
<p>Initializes the <code class="computeroutput">Allocator</code> base class with the base from other. </p>
</li>
</ol></div>
</div>
<div class="refsect2">
<a name="idp125972448"></a><h3>
<a name="idp38188272-bb"></a><code class="computeroutput">aligned_allocator_adaptor</code> public member functions</h3>
<div class="orderedlist"><ol class="orderedlist" type="1">
<li class="listitem">
<pre class="literallayout"><span class="identifier">Allocator</span> <span class="special">&amp;</span> <a name="idp38188832-bb"></a><span class="identifier">base</span><span class="special">(</span><span class="special">)</span> <span class="keyword">noexcept</span><span class="special">;</span></pre>
<p>
</p>
<div class="variablelist"><table border="0" class="variablelist compact">
<colgroup>
<col align="left" valign="top">
<col>
</colgroup>
<tbody><tr>
<td><p><span class="term">Returns:</span></p></td>
<td><p><code class="computeroutput">static_cast&lt;Allocator&amp;&gt;(*this)</code>. </p></td>
</tr></tbody>
</table></div>
</li>
<li class="listitem">
<pre class="literallayout"><span class="keyword">const</span> <span class="identifier">Allocator</span> <span class="special">&amp;</span> <a name="idp38191088-bb"></a><span class="identifier">base</span><span class="special">(</span><span class="special">)</span> <span class="keyword">const</span> <span class="keyword">noexcept</span><span class="special">;</span></pre>
<p>
</p>
<div class="variablelist"><table border="0" class="variablelist compact">
<colgroup>
<col align="left" valign="top">
<col>
</colgroup>
<tbody><tr>
<td><p><span class="term">Returns:</span></p></td>
<td><p><code class="computeroutput">static_cast&lt;const Allocator&amp;&gt;(*this)</code>. </p></td>
</tr></tbody>
</table></div>
</li>
<li class="listitem">
<pre class="literallayout"><span class="identifier">pointer</span> <a name="idp38193344-bb"></a><span class="identifier">allocate</span><span class="special">(</span><span class="identifier">size_type</span> size<span class="special">)</span><span class="special">;</span></pre>
<p>

</p>
<p><span class="bold"><strong>Throw:</strong></span> Throws an exception thrown from <code class="computeroutput">A2::allocate</code> if the storage cannot be obtained.</p>
<p><span class="bold"><strong>Note:</strong></span> The storage is obtained by calling <code class="computeroutput">A2::allocate</code> on an object <code class="computeroutput">a2</code>, where <code class="computeroutput">a2</code> of type <code class="computeroutput">A2</code> is a rebound copy of <code class="computeroutput">base()</code> where its <code class="computeroutput">value_type</code> is unspecified. </p>
<p>
</p>
<div class="variablelist"><table border="0" class="variablelist compact">
<colgroup>
<col align="left" valign="top">
<col>
</colgroup>
<tbody>
<tr>
<td><p><span class="term">Parameters:</span></p></td>
<td><div class="variablelist"><table border="0" class="variablelist compact">
<colgroup>
<col align="left" valign="top">
<col>
</colgroup>
<tbody><tr>
<td><p><span class="term"><code class="computeroutput">size</code></span></p></td>
<td><p>The size of the value type object to allocate.</p></td>
</tr></tbody>
</table></div></td>
</tr>
<tr>
<td><p><span class="term">Returns:</span></p></td>
<td><p>A pointer to the initial element of an array of storage of size <code class="computeroutput">n * sizeof(value_type)</code>, aligned on the maximum of the minimum alignment specified and the alignment of objects of type <code class="computeroutput">value_type</code>.</p></td>
</tr>
</tbody>
</table></div>
</li>
<li class="listitem">
<pre class="literallayout"><span class="identifier">pointer</span> <a name="idp38202160-bb"></a><span class="identifier">allocate</span><span class="special">(</span><span class="identifier">size_type</span> size<span class="special">,</span> <span class="identifier">const_void_pointer</span> hint<span class="special">)</span><span class="special">;</span></pre>
<p>

</p>
<p><span class="bold"><strong>Throw:</strong></span> Throws an exception thrown from <code class="computeroutput">A2::allocate</code> if the storage cannot be obtained.</p>
<p><span class="bold"><strong>Note:</strong></span> The storage is obtained by calling <code class="computeroutput">A2::allocate</code> on an object <code class="computeroutput">a2</code>, where <code class="computeroutput">a2</code> of type <code class="computeroutput">A2</code> is a rebound copy of <code class="computeroutput">base()</code> where its <code class="computeroutput">value_type</code> is unspecified. </p>
<p>
</p>
<div class="variablelist"><table border="0" class="variablelist compact">
<colgroup>
<col align="left" valign="top">
<col>
</colgroup>
<tbody>
<tr>
<td><p><span class="term">Parameters:</span></p></td>
<td><div class="variablelist"><table border="0" class="variablelist compact">
<colgroup>
<col align="left" valign="top">
<col>
</colgroup>
<tbody>
<tr>
<td><p><span class="term"><code class="computeroutput">hint</code></span></p></td>
<td><p>is a value obtained by calling <code class="computeroutput">allocate()</code> on any equivalent aligned allocator adaptor object, or else <code class="computeroutput">nullptr</code>.</p></td>
</tr>
<tr>
<td><p><span class="term"><code class="computeroutput">size</code></span></p></td>
<td><p>The size of the value type object to allocate.</p></td>
</tr>
</tbody>
</table></div></td>
</tr>
<tr>
<td><p><span class="term">Returns:</span></p></td>
<td><p>A pointer to the initial element of an array of storage of size <code class="computeroutput">n * sizeof(value_type)</code>, aligned on the maximum of the minimum alignment specified and the alignment of objects of type <code class="computeroutput">value_type</code>.</p></td>
</tr>
</tbody>
</table></div>
</li>
<li class="listitem">
<pre class="literallayout"><span class="keyword">void</span> <a name="idp49504000-bb"></a><span class="identifier">deallocate</span><span class="special">(</span><span class="identifier">pointer</span> ptr<span class="special">,</span> <span class="identifier">size_type</span> size<span class="special">)</span><span class="special">;</span></pre>
<p>Deallocates the storage referenced by <code class="computeroutput">ptr</code>.</p>
<p>
</p>
<p><span class="bold"><strong>Note:</strong></span> Uses <code class="computeroutput">A2::deallocate</code> on an object <code class="computeroutput">a2</code>, where <code class="computeroutput">a2</code> of type <code class="computeroutput">A2</code> is a rebound copy of <code class="computeroutput">base()</code> where its <code class="computeroutput">value_type</code> is unspecified. </p>
<p>
</p>
<div class="variablelist"><table border="0" class="variablelist compact">
<colgroup>
<col align="left" valign="top">
<col>
</colgroup>
<tbody><tr>
<td><p><span class="term">Parameters:</span></p></td>
<td><div class="variablelist"><table border="0" class="variablelist compact">
<colgroup>
<col align="left" valign="top">
<col>
</colgroup>
<tbody>
<tr>
<td><p><span class="term"><code class="computeroutput">ptr</code></span></p></td>
<td><p>Shall be a pointer value obtained from <code class="computeroutput">allocate()</code>.</p></td>
</tr>
<tr>
<td><p><span class="term"><code class="computeroutput">size</code></span></p></td>
<td><p>Shall equal the value passed as the first argument to the invocation of <code class="computeroutput">allocate</code> which returned <code class="computeroutput">ptr</code>.</p></td>
</tr>
</tbody>
</table></div></td>
</tr></tbody>
</table></div>
</li>
</ol></div>
</div>
</div>
</div>
<table xmlns:rev="http://www.cs.rpi.edu/~gregod/boost/tools/doc/revision" width="100%"><tr>
<td align="left"></td>
<td align="right"><div class="copyright-footer">Copyright &#169; 2014 Glen Fernandes<p>
        Distributed under the <a href="http://boost.org/LICENSE_1_0.txt" target="_top">Boost
        Software License, Version 1.0</a>.
      </p>
</div></td>
</tr></table>
<hr>
<div class="spirit-nav">
<a accesskey="p" href="operator___idp38164192.html"><img src="../../../../doc/src/images/prev.png" alt="Prev"></a><a accesskey="u" href="../../align/reference.html#header.boost.align.aligned_allocator_adaptor_hpp"><img src="../../../../doc/src/images/up.png" alt="Up"></a><a accesskey="h" href="../../index.html"><img src="../../../../doc/src/images/home.png" alt="Home"></a><a accesskey="n" href="aligned_allocator_adaptor/rebind.html"><img src="../../../../doc/src/images/next.png" alt="Next"></a>
</div>
</body>
</html>
